
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="renderer" content="webkit" />
<title>主页</title>

    <link rel="stylesheet" type="text/css" href="../../../plugins/bootstrap/3.3.7/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../../../plugins/jquery-easyui/1.8.6/themes/gray/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../../../plugins/jquery-easyui/1.8.6/themes/icon.css" />
    <!-- font-awesome图标字体 -->
    <link rel="stylesheet" href="../../../plugins/font-awesome/css/font-awesome.min.css" />
    
    <link rel="stylesheet" href="../../../plugins/zTree_v3/css/zTreeStyle/zTreeStyle.css" media="all" />
    
    <link rel="stylesheet" type="text/css" href="../../../css/zbootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/zeasyui.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/common.css" />
    
    <script type="text/javascript" src="../../../plugins/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="../../../plugins/jquery-rstorage/1.3.2/jquery.rStorage.min.js"></script>
    <script type="text/javascript" src="../../../plugins/jquery-easyui/1.8.6/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../../plugins/jquery-form/4.3.0/jquery.form.min.js"></script>
    
    <script type="text/javascript" src="../../../plugins/zTree_v3/js/jquery.ztree.all.js"></script>
    <script type="text/javascript" src="../../../plugins/zTree_v3/js/jquery.ztree.exhide.js"></script>
    
    <script type="text/javascript" src="../../../js/zGlobal.js"></script>
    <script type="text/javascript" src="../../../js/zApi.js"></script>
    <script type="text/javascript" src="../../../js/zUtil.js"></script>
    <script type="text/javascript" src="../../../js/zAlert.js"></script>
    <script type="text/javascript" src="../../../js/zDict.js"></script>
    <script type="text/javascript" src="../../../js/zTable.js"></script>
    <script type="text/javascript" src="../../../js/zDialog.js"></script>
    <script type="text/javascript" src="../../../js/zForm.js"></script>
    
    <![if IE]>

    <![endif]>

</head>
<body onload="noright(document.body);">

    <div id="p-all" class="easyui-layout" data-options="fit:true,border:false," style="border: 0px solid #D8D9E5;"> 
     <div data-options="region:'center',split:false,border:false,minWidth:500" style="overflow: hidden;width:50%;border-right:1px solid rgb(210, 208, 208);"> 
       <div style="height: 36px;padding:5px 3px;position: absolute;z-index: 2;right: 2px;">
        <input id="table-toggle" class="easyui-switchbutton" style="" />
       </div> 
      <table id="table-left"></table> 
     </div> 
     <div data-options="region:'east',split:true,border:false,minWidth:500" style="overflow: hidden;width:50%;border-left:1px solid rgb(210, 208, 208);"> 
      <table id="table-right"></table> 
     </div> 
    </div> 

  <!---分割-------------------------------------------------------------------------------->
  <div id="dlg-add-left" style="display:none;"> 
   <div class="main-content"> 
    <form>
     <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <div class="col-sm-12"> 
          <div class="row" style="padding: 3px;"> 
           <fieldset style="border: 1px solid #e5e5e5;padding-bottom: 5px;"> 
              <legend class=" text-info">说明</legend>
              <span style="color: red;">#、创建好后使用“同步”功能解析表结构到本地，离线解析需要先上传文件</span><br>
              <span style="color: red;">
              #、在线解析数据库、在线查询SQL时则需要填写数据库连接信息；“其他”数据库只支持离线解析表结构  </span>
           </fieldset>
          </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">项目标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="projectTitle" name="projectTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">数据源加载方式</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="loadType" name="loadType" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">数据库类型</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="databaseType" name="databaseType" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">映射方式</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="mappingId" name="mappingId" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JDBC地址</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="jdbcUrl" name="jdbcUrl" data-options="prompt:'jdbc:oracle:thin:@127.0.0.1:1521:orcl'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JDBC用户/密码</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="jdbcLoginname" name="jdbcLoginname" data-options="prompt:'用户名'" style="width:30%;" /> 
        &nbsp;&nbsp;
        <input class="easyui-textbox" id="jdbcPassword" name="jdbcPassword" data-options="prompt:'密码'" style="width:30%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">文件编码</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="characterEncoding" name="characterEncoding" data-options="required:true,panelHeight:80" style="width:100%;" >
           <option value="UTF-8">UTF-8</option>
        </select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">去除表词缀</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="prefixOverride" name="prefixOverride" data-options="prompt:'正则匹配，例如：前缀^TBL_，后缀_INFO$'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">去除文件前缀</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="suffixOverride" name="suffixOverride" data-options="prompt:'前缀匹配，例如：I，T...'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">预加载表</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="loadTables" name="loadTables" data-options="multiline:true,height:80,prompt:'表编码,逗号分隔，例：TBL_,T_USER'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">预加载序号</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="loadSeqs" name="loadSeqs" data-options="multiline:true,height:80,prompt:'自增序列编码,逗号分隔，例：SEQ_,SEQ_USER_ID'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     
     </div> 
    </form> 
   </div> 
  </div>


  <div id="dlg-edit-left" style="display:none;"> 
   <div class="main-content"> 
    <form>
     <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <input id="projectId" name="projectId" type="hidden" /> <!-- 项目主键ID -->
     
     <div class="col-sm-6"> 
      <label class="form-lable">项目标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="projectTitle" name="projectTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">数据源加载方式</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="loadType" name="loadType" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">数据库类型</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="databaseType" name="databaseType" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">映射方式</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="mappingId" name="mappingId" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JDBC地址</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="jdbcUrl" name="jdbcUrl" data-options="prompt:'jdbc:oracle:thin:@127.0.0.1:1521:orcl'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">JDBC用户/密码</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="jdbcLoginname" name="jdbcLoginname" data-options="prompt:'用户名'" style="width:30%;" /> 
        &nbsp;&nbsp;
        <input class="easyui-textbox" id="jdbcPassword" name="jdbcPassword" data-options="prompt:'密码'" style="width:30%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">PDM文件</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="pdmPath" name="pdmPath" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">其他文件</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="sqlPath" name="sqlPath" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">文件编码</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="characterEncoding" name="characterEncoding" data-options="required:true,panelHeight:80" style="width:100%;" >
           <option value="UTF-8">UTF-8</option>
        </select>
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">去除表词缀</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="prefixOverride" name="prefixOverride" data-options="prompt:'正则匹配，例如：前缀^TBL_，后缀_INFO$'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">去除文件前缀</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="suffixOverride" name="suffixOverride" data-options="prompt:'前缀匹配，例如：I，T...'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">预加载表</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="loadTables" name="loadTables" data-options="multiline:true,height:80,prompt:'表编码,逗号分隔，例：TBL_,T_USER'" style="width:100%;" /> 
      </div>
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">预加载序号</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="loadSeqs" name="loadSeqs" data-options="multiline:true,height:80,prompt:'自增序列编码,逗号分隔，例：SEQ_,SEQ_USER_ID'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">状态</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="dataStatus" name="dataStatus" data-options="multiple:false" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建操作员</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createOprid" name="createOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建操作员姓名</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createName" name="createName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createTm" name="createTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新操作员</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdOprid" name="lastUpdOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新操作员姓名</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdName" name="lastUpdName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdTm" name="lastUpdTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form> 
   </div> 
  </div>

  <div id="dlg-query-left" style="display:none;">
   <div class="main-content">
    <form>
     <div class="row padding-right">
     <div class="col-sm-12"> 
      <label class="form-lable">项目id</label> 
      <div class="input-block"> 
        <select class="easyui-textbox" id="projectId" name="projectId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">项目标题</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="projectTitle" name="projectTitle" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form>
   </div>
  </div>
  <!---分割-------------------------------------------------------------------------------->
  <div id="dlg-add-right" style="display:none;">
   <div class="main-content"> 
    <form>
     <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <div class="col-sm-6"> 
      <label class="form-lable">所属项目</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="projectId" name="projectId" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">模块标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="moduleTitle" name="moduleTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">基础包路径</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="basePackagePath" name="basePackagePath" data-options="required:true,validType : ['packagePath'],prompt:'例如：com.my'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">包路径</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="outputPackagePath" name="outputPackagePath" data-options="required:true,validType : ['letterNum'],prompt:'例如：system'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">页面根目录</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="outputRootPath" name="outputRootPath" data-options="validType : ['filePath'],prompt:'例如：/static/page/'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">作者</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="tagAuthor" name="tagAuthor" data-options="prompt:'模板内使用，tagAuthor'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">说明1</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="tagExplain1" name="tagExplain1" data-options="multiline:true,height:80,prompt:'模板内使用，tagExplain1'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">说明2</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="tagExplain2" name="tagExplain2" data-options="multiline:true,height:80,prompt:'模板内使用，tagExplain2'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     
     </div> 
    </form> 
   </div> 
  </div>
  
  <div id="dlg-edit-right" style="display:none;">
   <div class="main-content"> 
    <form>
     <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <input id="moduleId" name="moduleId" type="hidden" /> <!-- 模块主键ID -->
     
     <div class="col-sm-6"> 
      <label class="form-lable">所属项目</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="projectId" name="projectId" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">模块标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="moduleTitle" name="moduleTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">基础包路径</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="basePackagePath" name="basePackagePath" data-options="required:true,validType : ['packagePath'],prompt:'例如：com.my'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">包路径</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="outputPackagePath" name="outputPackagePath" data-options="required:true,validType : ['letterNum'],prompt:'例如：system'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">页面根目录</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="outputRootPath" name="outputRootPath" data-options="validType : ['filePath'],prompt:'例如：/static/page/'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">作者</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="tagAuthor" name="tagAuthor" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">说明1</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="tagExplain1" name="tagExplain1" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">说明2</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="tagExplain2" name="tagExplain2" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;"> 
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">状态</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="dataStatus" name="dataStatus" data-options="multiple:false" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建操作员</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createOprid" name="createOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建操作员姓名</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createName" name="createName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createTm" name="createTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新操作员</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdOprid" name="lastUpdOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新操作员姓名</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdName" name="lastUpdName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdTm" name="lastUpdTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form> 
   </div> 
  </div>
  
  <div id="dlg-query-right" style="display:none;">
   <div class="main-content">
    <form>
     <div class="row padding-right">
     <div class="col-sm-12"> 
      <label class="form-lable">所属项目</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="projectId" name="projectId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">模块id</label> 
      <div class="input-block"> 
        <select class="easyui-textbox" id="moduleId" name="moduleId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">模块标题</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="moduleTitle" name="moduleTitle" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form>
   </div>
  </div>

  <div id="dlg-load-tables" style="display:none;">
   <div class="main-content">
    <form>
     <div class="row">&nbsp;</div>
     <div class="row"> 
     <fieldset> 
      <legend>同步配置</legend> 
     </fieldset> 
     </div> 
     <div class="row padding-right">
     <input id="projectId" name="projectId" type="hidden" /> <!-- 项目主键ID -->
     
     <div class="col-sm-6"> 
      <label class="form-lable">所属项目</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="projectTitle" name="projectTitle" data-options="" style="width:100%;" /> 
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">数据源加载方式</label> 
      <div class="input-block">
         <select class="easyui-combobox" id="loadType" name="loadType" data-options="panelHeight:200" style="width:100%;" ></select>
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">加载内容</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="loadSourceType" name="loadSourceType" data-options="panelHeight:200" style="width:100%;" ></select>
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">是否覆盖</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="coverFlag" name="coverFlag" data-options="panelHeight:80,panelHeight:80" style="width:100%;" ></select>
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">匹配模式</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="queryType" name="queryType" data-options="panelHeight:80" style="width:100%;" ></select>
      </div> 
     </div>
     <div class="col-sm-12"> 
      <label class="form-lable">加载表<br><a href="javascript:void(0);" class="easyui-linkbutton" onclick="dlgSelectTableInfo();">快捷选择</a></label> 
      <div class="input-block">
        <input class="easyui-textbox" id="loadTables" name="loadTables" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div>
     <div class="col-sm-12"> 
      <label class="form-lable">加载序号<br><a href="javascript:void(0);" class="easyui-linkbutton" onclick="">快捷选择</a></label> 
      <div class="input-block">
        <input class="easyui-textbox" id="loadSeqs" name="loadSeqs" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div>
     
     </div> 
     
     <div class="row"> 
     <fieldset> 
      <legend>同步结果/数据库关键字检测</legend> 
     </fieldset> 
     </div> 
     <div class="row padding-right">
     <div class="col-sm-12"> 
      <table id="loadTablesResult" class="table table-condensed">
        <thead><tr><th style="width:300px;">表名</th><th>冲突关键字（若无影响则可以忽略）<span style="color:red">关键字在<a href="javascript:void(0);" class="easyui-linkbutton" style="color: blue;" onclick="window.parent.tabOpen('ZL_KEYWORD');">数据库关键字</a>
        ；表在<a href="javascript:void(0);" class="easyui-linkbutton" style="color: blue;" onclick="window.parent.tabOpen('ZL_TABLE');">数据库表</a></span></th></tr></thead>
        <tbody></tbody>
      </table> 
     </div>
     </div>
     
    </form>
   </div>
  </div>


  <div id="dlg-file-left" style="display:none;">
    <div class="main-content">
     <div class="easyui-layout" data-options="fit:true,border:false">
       <div class="no-tip"data-options="region:'west',split:true,border:false,title:'已上传文件',expandMode:'dock'" style="overflow: hidden;width:300px;border-right:1px solid rgb(210, 208, 208);"> 
          <div class="overflow-y"><ul id="tree-code-file" class="ztree"></ul></div>
       </div>
       <div class="no-tip" data-options="region:'center',split:false,border:false,title:'文件内容'" style="overflow: hidden;width:auto;border-left:1px solid rgb(210, 208, 208);"> 
          <form enctype="multipart/form-data">
     <div class="row"> 
     <div class="col-sm-12"> 
       <label class="form-lable">文件类型</label> 
       <select class="easyui-combobox" id="fileType" name="fileType" data-options="panelHeight:100" style="width:100%;" ></select>
     </div> 
     <div class="col-sm-12"> 
       <label class="form-lable">上传文件</label> 
        <input class="easyui-filebox" id="fileObj" name="fileObj" data-options="required:true,prompt:'zip,pdm,txt,java',accept:'',buttonText:'选择',validType:['fileSize[5,\'MB\']']" style="width:100%">
     </div> 
     </div>
     <div class="row" style="color: red;"> 
     <div class="col-sm-12"> 
              上传zip将删除对应目录全部文件
      </div> 
     </div>
     <div class="row" style="color: red;"> 
     <div class="col-sm-12"> 
              单个文件上传为增量上传,同名覆盖
      </div> 
     </div>
     <div class="row" style="color: red;"> 
     <div class="col-sm-12" style="color: blue;"><p></p> 上传完成后：<a href="javascript:void(0);" class="easyui-linkbutton" onclick="dlgLoadTables();">同步表结构</a>
      </div> 
      <div class="col-sm-12"> 使用同步功能，保存表记录.
      </div> 
     </div>
   </form>
       </div>
      </div>
   </div>
  </div>
  
   
  </div>

  <div id="dlg-select-table-info" style="display:none;overflow: hidden;">
   <div class="main-content">
      <div  style="height: 100%; overflow: auto;" > 
        <div id="table-info-toolbar" style="padding:5px;height:auto">
        <div>
            <span>表编码 </span><input id="loadTables" name="loadTables" class="easyui-textbox" data-options="prompt:'模糊查询'" style="width:300px" />
            <input id="loadSourceType" name="loadSourceType" type="hidden"  value=""/>
            <input id="queryType" name="queryType" type="hidden"  value=""/>
            <input id="projectId" name="projectId" type="hidden"  value=""/>
            <input id="loadType" name="loadType" type="hidden"  value=""/>
            <a href="javascript:void(0);" class="easyui-linkbutton" id="toolbar-bt1">查询</a>
        </div>
        </div>
        <table id="table-info"></table>
       </div> 
   </div>
  </div>


 <script>
  TableToggleFlag = true;//默认开启联动
  TableSelectFlag = null;//默认未选中
  DictNames = {};
  
  /* --分割------------------------------------------------------------------------------ */
  
  TitleLeft = "项目配置";
  IdDlgAddLeft = "#dlg-add-left";
  IdDlgEditLeft = "#dlg-edit-left";
  IdDlgQueryLeft = "#dlg-query-left";
  IdTableLeft = "#table-left";
  TableHeaderLeftMenu = null;
  
  /* --分割------------------------------------------------------------------------------ */
  
  TitleRight = "项目模块配置";
  IdDlgAddRight = "#dlg-add-right";
  IdDlgEditRight = "#dlg-edit-right";
  IdDlgQueryRight = "#dlg-query-right";
  IdTableRight = "#table-right";
  TableHeaderRightMenu = null;
  
  /* --分割------------------------------------------------------------------------------ */
  IdDlgFileLeft = "#dlg-file-left";
  IdDlgLoadTables = "#dlg-load-tables";
  IdDlgSelectTableInfo = "#dlg-select-table-info";
  IdTableInfo = IdDlgSelectTableInfo + " #table-info";
  IdTableInfoTb = IdDlgSelectTableInfo + " #table-info-toolbar";
  IdTableInfoTbBt1 = IdTableInfoTb + " #toolbar-bt1";
  
  /* --分割------------------------------------------------------------------------------ */
  zUtil.dictLoadSyncOfAutocode("dict.dataStatus,dict.databaseType,project.loadType,project.loadSourceType"
               +",project.queryType,dict.booleanFlag,project.fileType"
               +",ZSELECT_PROJECT,ZSELECT_FIELD_MAPPING");
  $(function(){
    $('#table-toggle').switchbutton({
      checked:true,
      handleText:'明细',
      width:75,
      height:25,
      handleWidth:35,
      onChange:function(checked){
        if(checked){
          TableToggleFlag = true;
          $('#p-all').layout('expand','east');
        }else{
          TableToggleFlag = false;
          $('#p-all').layout('collapse','east');
        }
        $('#p-all .layout-expand.layout-expand-east').addClass('disabled');
      }
    });
    zUtil.areaSize();
    
    /* --分割------------------------------------------------------------------------------ */
    
    var urlLeft = zGlobal["http"] + "/api/autocode/project/list";
    var buttonsIdxLeft = [0,4];
    var buttonsFuncLeft = [dlgAddLeft,dlgQueryLeft];
    var optionsLeft = {
            queryParams:{},
            url : urlLeft,
            idField: 'projectId',
            sortName: 'orderNum',
            sortOrder: 'desc',
            multiSort: true,
            columns:[[
                {field: 'projectId', title: '项目主键ID', align: 'center', width: 100, hidden: true},
                {field: 'databaseType', title: '数据库类型', align: 'center', width: 100,sortable: true, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"dict.databaseType")}},
                {field: 'loadType', title: '加载类型', align: 'center', width: 80, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"project.loadType")}},
                {field: 'mappingId', title: '映射方式', align: 'center', width: 100, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"ZSELECT_FIELD_MAPPING")}},
                {field: 'prefixOverride', title: '去除表词缀', align: 'center', width: 100},
                {field: 'suffixOverride', title: '去除文件前缀', align: 'center', width: 100},
                {field: 'orderNum', title: '排序', align: 'center', width: 50,sortable: true},
                {field: 'dataStatus', title: '状态', align: 'center', width: 50, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"dict.dataStatus")}},
                {field: 'createName', title: '创建操作员', align: 'center', width: 100},
                {field: ' ', title: ' ', align: 'center', width: 100},
            ]],
            frozenColumns:[[
//              {field:'', title:'', align:'center', checkbox:true},
             {field:'buttonArr', title:'操作', align:'center', width: 60, formatter:buttonsFormatterLeft},
             {field: 'projectTitle', title: '项目标题', align: 'left',halign: 'center', width: 100},
            ]],
            onDblClickCell: function(rowIndex, field, value){
                if("buttonArr" != field){
                    dlgDtlLeft(rowIndex);
                }
            },
            onSelect: function(rowIndex, rowData){
              if(TableToggleFlag && rowData['projectId'] != TableSelectFlag){
                TableSelectFlag = rowData['projectId'];
                zUtil.formClear(IdDlgQueryRight + ' form');
                zUtil.val(IdDlgQueryRight + ' #projectId',rowData['projectId']);
                zUtil.readonly(IdDlgQueryRight + ' #projectId');
                zUtil.tableQuery(IdTableRight,{
                  'projectId': rowData['projectId']
                },{url:urlRight});
              }
            },
            onHeaderContextMenu: function(e, field){
              TableHeaderLeftMenu = zUtil.tableHeaderMenu(e,TableHeaderLeftMenu,IdTableLeft);
            },
            onRowContextMenu: function(e, rowIndex, rowData){
              e.preventDefault();
              zUtil.tableSelected(IdTableLeft,rowIndex);
              if(rowData != null){
                  dlgEditLeft(rowData);
              }
            },
    };
    zUtil.tableInit(IdTableLeft,optionsLeft,buttonsIdxLeft,buttonsFuncLeft);
    
    
    /* --分割------------------------------------------------------------------------------ */
    var urlRight = zGlobal["http"] + "/api/autocode/projectModule/list";
    var buttonsIdxRight = [0,4];
    var buttonsFuncRight = [dlgAddRight,dlgQueryRight];
    var optionsRight = {
            queryParams:{},
            url : '',
            idField: 'moduleId',
            sortName: 'projectId,orderNum',
            sortOrder: 'desc,desc',
            multiSort: true,
            columns:[[
                {field: 'moduleId', title: '模块主键ID', align: 'center', width: 100, hidden: true},
                {field: 'projectId', title: '项目主键ID', align: 'center', width: 100, hidden: true},
                {field: 'basePackagePath', title: '基础包路径', align: 'center', width: 120},
                {field: 'outputPackagePath', title: '包路径', align: 'center', width: 60},
//                 {field: 'outputModulePath', title: '模块路径', align: 'center', width: 80},
                {field: 'outputRootPath', title: '页面根目录', align: 'center', width: 100},
                {field: 'orderNum', title: '排序', align: 'center', width: 50},
                {field: 'dataStatus', title: '状态', align: 'center', width: 50, formatter: function(value,rowData,rowIndex){return zUtil.dictConvertOfAutocode(value,"dict.dataStatus")}},
                {field: 'createName', title: '创建操作员', align: 'center', width: 100},
                {field: ' ', title: ' ', align: 'center', width: 100},
            ]],
            frozenColumns:[[
//              {field:'', title:'', align:'center', checkbox:true},
             {field:'buttonArr', title:'操作', align:'center', width: 60, formatter:buttonsFormatterRight},
             {field: 'moduleTitle', title: '模块标题', align: 'left',halign: 'center', width: 100},
            ]],
            onDblClickCell: function(rowIndex, field, value){
                if("buttonArr" != field){
                    dlgDtlRight(rowIndex);
                }
            },
            onSelect: function(rowIndex, rowData){
            },
            onHeaderContextMenu: function(e, field){
              TableHeaderRightMenu = zUtil.tableHeaderMenu(e,TableHeaderRightMenu,IdTableRight);
            },
            onRowContextMenu: function(e, rowIndex, rowData){
              e.preventDefault();
              zUtil.tableSelected(IdTableRight,rowIndex);
              if(rowData != null){
                  dlgEditRight(rowData);
              }
            },
    };
    zUtil.tableInit(IdTableRight,optionsRight,buttonsIdxRight,buttonsFuncRight);
    
        
        
    /* --分割------------------------------------------------------------------------------ */
    DictNames['dict.dataStatus'] = 'dataStatus';
    DictNames['dict.databaseType'] = 'databaseType';
    DictNames['project.loadType'] = 'loadType';
    DictNames['project.loadSourceType'] = 'loadSourceType';
    DictNames['project.queryType'] = 'queryType';
    DictNames['dict.booleanFlag'] = 'coverFlag';
    DictNames['project.fileType'] = 'fileType';
    DictNames['ZSELECT_FIELD_MAPPING'] = 'mappingId';
    DictNames['ZSELECT_PROJECT'] = 'projectId';
    
    var linkSelsetIds = [IdDlgQueryLeft,IdDlgAddLeft,IdDlgEditLeft,IdDlgQueryRight
        ,IdDlgAddRight,IdDlgEditRight,IdDlgLoadTables,IdDlgFileLeft];
    $.each(linkSelsetIds,function(i,item){
        zUtil.selectFill(item,DictNames,zDictAutocode);
        
        zUtil.selectOn(item +" #databaseType",function(data){
            if(!data){return;}
            
            //拆解参数
            $.each(zDictAutocode["ZSELECT_FIELD_MAPPING"],function(k,item){
                if(!zDictAutocode['ZSELECT_FIELD_MAPPING_'+item['databaseType']]){
                    zDictAutocode['ZSELECT_FIELD_MAPPING_'+item['databaseType']] = {};
                }
                if(item['databaseType'] === data['value']){
                    zDictAutocode['ZSELECT_FIELD_MAPPING_'+item['databaseType']][k] = item;
                }
            });
            
            zUtil.selectClear(item +" #mappingId");
            DictNames = {};
            if(data['value'] !== 'other'){
                DictNames["ZSELECT_FIELD_MAPPING_"+data['value']] = "mappingId";
            }else{
                DictNames["ZSELECT_FIELD_MAPPING"] = "mappingId";
            }
            zUtil.selectFill(item, DictNames, zDictAutocode);
        });
    });
    
    $(IdTableInfoTbBt1).on('click',function(){
        tableInfoQuery();
    });
  });
  
  /* --分割------------------------------------------------------------------------------ */
  
  //TODO
  function buttonsFormatterLeft(value,rowData,rowIndex){
      return '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgDelLeft('+rowIndex+');" title="删除" ><i class="fa fa-trash"> </i></a> '
          +'<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgFileLeft('+rowIndex+');" title="上传/同步"><i class="fa fa-upload"> </i></a> '
          +'<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgLoadTables('+rowIndex+');" title="同步表结构"><i class="fa fa-refresh"> </i></a> '
          ;
  }
  //TODO
  function dlgQueryLeft(){
    var dlgSave = function(){
      var params = zUtil.valAll(IdDlgQueryLeft);
      zUtil.tableQuery(IdTableLeft,params);
      zUtil.tableData(IdTableRight,[]);
      zUtil.tableUnSelected(IdTableLeft);
      TableSelectFlag = null;
    };
    var dlgClear = function(){
      zUtil.formClear(IdDlgQueryLeft + ' form');
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgQueryLeft);
    };
    var dlgOptions = {
      title: TitleLeft + '-查询',
    };
    var dlgButtonsIdx = [0,1,2];
    var dlgButtonsFunc =  [dlgSave,dlgClear,dlgClose];
    zUtil.queryInit(IdDlgQueryLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgQueryLeft);
  };
  //TODO
  function dlgQueryxLeft(){
    //zUtil.dialogOpen(IdDlgQueryxLeft);
  };
  //TODO
  function dlgAddLeft(){
    zUtil.formClear(IdDlgAddLeft + ' form');
    zUtil.readonlyAll(IdDlgAddLeft,false);
    zUtil.readonly(IdDlgAddLeft +" #pdmPath");
    zUtil.readonly(IdDlgAddLeft +" #sqlPath");
    
    zUtil.val(IdDlgAddLeft +" #characterEncoding","UTF-8");
    
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgAddLeft +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgAddLeft);
      var reqData = {reqData: params};
      var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/project/add", reqData);
      if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
        var params = zUtil.valAll(IdDlgQueryLeft);
        zUtil.tableQuery(IdTableLeft,params);
        zUtil.dialogClose(IdDlgAddLeft);
        zUtil.dictLoadSyncOfAutocode("ZSELECT_PROJECT");
      }else{
        zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        return false;
      }
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgAddLeft);
    };
    var dlgOptions = {
       title: TitleLeft + '-新增',
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgAddLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);   
    zUtil.dialogOpen(IdDlgAddLeft);
  };
  //TODO  
  function dlgEditLeft(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }
    
    zUtil.formClear(IdDlgEditLeft + ' form');
    zUtil.readonlyAll(IdDlgEditLeft,false);
    zUtil.readonly(IdDlgEditLeft + ' #projectId');
    zUtil.readonly(IdDlgEditLeft +" #pdmPath");
    zUtil.readonly(IdDlgEditLeft +" #sqlPath");
    zUtil.readonly(IdDlgEditLeft + ' #dataStatus');
    zUtil.readonly(IdDlgEditLeft + ' #createOprid');
    zUtil.readonly(IdDlgEditLeft + ' #createName');
    zUtil.readonly(IdDlgEditLeft + ' #createTm');
    zUtil.readonly(IdDlgEditLeft + ' #lastUpdOprid');
    zUtil.readonly(IdDlgEditLeft + ' #lastUpdName');
    zUtil.readonly(IdDlgEditLeft + ' #lastUpdTm');
    
    var params = {};
    params['projectId']  = row['projectId'];
    var detail = zUtil.ajaxGetSync(zGlobal["http"] + "/api/autocode/project/detail", params);
    if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(detail,zConst["busCode"])){
      zUtil.msg('获取信息失败');
      return false;
    }
    detail = detail[zConst["resData"]];
          
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgEditLeft +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgEditLeft);
      var reqData = {reqData: params};
      var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/project/edit", reqData);
      if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
        var params = zUtil.valAll(IdDlgQueryLeft);
        zUtil.tableQuery(IdTableLeft,params);
        zUtil.dialogClose(IdDlgEditLeft);
      }else{
        zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        return false;
      }
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditLeft);
    };
    var dlgOptions = {
      title: TitleLeft + '-编辑',
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgEditLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.valAll(IdDlgEditLeft,detail);
    zUtil.dialogOpen(IdDlgEditLeft);
  };
  //TODO
  function dlgDtlLeft(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }
    zUtil.formClear(IdDlgEditLeft + ' form');
    zUtil.readonlyAll(IdDlgEditLeft);
    
    var params = {};
    params['projectId']  = row['projectId'];
    var detail = zUtil.ajaxGetSync(zGlobal["http"] + "/api/autocode/project/detail", params);
    if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(detail,zConst["busCode"])){
      zUtil.msg('获取信息失败');
      return false;
    }
    detail = detail[zConst["resData"]];
          
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditLeft);
    };
    var dlgOptions = {
      title: TitleLeft + '-详情',
    };
    var dlgButtonsIdx = [1];
    var dlgButtonsFunc =  [dlgClose];
    zUtil.dialogInit(IdDlgEditLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.valAll(IdDlgEditLeft,detail);
    zUtil.dialogOpen(IdDlgEditLeft);
  };
  //TODO
  function dlgDelLeft(row){
    if($.isNumeric(row)){
        zUtil.tableSelected(IdTableLeft,row);
        row = zUtil.tableRows(IdTableLeft);
    }
    
    var params = {}; 
    params['projectId']  = row['projectId'];
    var reqData = {reqData: params};
    var okfunc = function(){
    var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/project/del", reqData);
      if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
        var params = zUtil.valAll(IdDlgQueryLeft);
        zUtil.tableQuery(IdTableLeft,params);
      }else{
        zUtil.msg('操作失败'+(result.busMsg?'. '+result.busMsg:''));
        return false;
      }
    }
    zUtil.msgConfirm("确认删除已选中记录?",okfunc);
  };
  //TODO 
  function dlgDelLeftProject(){
    var row = zUtil.tableRows(IdTableLeft);
    if(!row){
        zUtil.msg('请先选择记录');
        return false;
    }
    var params = {}; 
    params['projectId']  = row['projectId'];
    var reqData = {reqData: params};
    var okfunc = function(){
    var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/project/delProjectAndModule", reqData);
      if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
        var params = zUtil.valAll(IdDlgQueryLeft);
        zUtil.tableQuery(IdTableLeft,params);
        zUtil.tableData(IdTableRight,[]);
      }else{
        zUtil.msg('操作失败');
        return false;
      }
    }
    zUtil.msgConfirm("删除项目、模块及其下级全部配置?",okfunc);
  };
  
  /* --分割------------------------------------------------------------------------------ */
  //TODO
  function getTableLeft(){
      var rowLeft =  zUtil.tableRows(IdTableLeft);
      if(rowLeft == null || rowLeft.length == 0){
          zUtil.msg('未选择左侧数据');
          return null;
      }
      return rowLeft;
  }
  //TODO
  function buttonsFormatterRight(value,rowData,rowIndex){
    return '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgDelRight('+rowIndex+');" title="删除" ><i class="fa fa-trash"> </i></a> ';
  }
  //TODO
  function dlgQueryRight(){
    var rowLeft = getTableLeft();
    if(rowLeft == null){
      return false;
    };
    zUtil.readonly(IdDlgQueryRight + ' #projectId');

    var dlgSave = function(){
      var params = zUtil.valAll(IdDlgQueryRight);
      zUtil.tableQuery(IdTableRight,params);
    };
    var dlgClear = function(){
      zUtil.formClear(IdDlgQueryRight + ' form');
      zUtil.val(IdDlgQueryRight + ' #projectId',rowLeft['projectId']);
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgQueryRight);
    };
    var dlgOptions = {
      title: TitleRight + '-查询',
    };
    var dlgButtonsIdx = [0,1,2];
    var dlgButtonsFunc =  [dlgSave,dlgClear,dlgClose];
    zUtil.queryInit(IdDlgQueryRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgQueryRight);
  };
  //TODO
  function dlgQueryxRight(){
    //zUtil.dialogOpen(IdDlgQueryxRight);
  };
  //TODO
  function dlgAddRight(){
    var rowLeft = getTableLeft();
    if(rowLeft == null){
      return false;
    };
    
    zUtil.formClear(IdDlgAddRight + ' form');
    zUtil.readonlyAll(IdDlgAddRight,false);
    zUtil.val(IdDlgAddRight + ' #projectId',rowLeft['projectId'])
    zUtil.readonly(IdDlgAddRight + ' #projectId');
    
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgAddRight +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgAddRight);
      var reqData = {reqData: params};
      var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/projectModule/add", reqData);
      if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
        var params = zUtil.valAll(IdDlgQueryRight);
        zUtil.tableQuery(IdTableRight,params);
        zUtil.dialogClose(IdDlgAddRight);
      }else{
        zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        return false;
      }
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgAddRight);
    };
    var dlgOptions = {
       title: TitleRight + '-新增',
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgAddRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);   
    zUtil.dialogOpen(IdDlgAddRight);
  };
  //TODO  
  function dlgEditRight(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableRight,row);
      row = zUtil.tableRows(IdTableRight);
    }
    zUtil.formClear(IdDlgEditRight + ' form');
    zUtil.readonlyAll(IdDlgEditRight,false);
    zUtil.readonly(IdDlgEditRight + ' #moduleId');
    zUtil.readonly(IdDlgEditRight + ' #projectId');
    zUtil.readonly(IdDlgEditRight + ' #dataStatus');
    zUtil.readonly(IdDlgEditRight + ' #createOprid');
    zUtil.readonly(IdDlgEditRight + ' #createName');
    zUtil.readonly(IdDlgEditRight + ' #createTm');
    zUtil.readonly(IdDlgEditRight + ' #lastUpdOprid');
    zUtil.readonly(IdDlgEditRight + ' #lastUpdName');
    zUtil.readonly(IdDlgEditRight + ' #lastUpdTm');
    
    var params = {};
    params['moduleId']  = row['moduleId'];
    var detail = zUtil.ajaxGetSync(zGlobal["http"] + "/api/autocode/projectModule/detail", params);
    if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(detail,zConst["busCode"])){
      zUtil.msg('获取信息失败');
      return false;
    }
    detail = detail[zConst["resData"]];
          
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgEditRight +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgEditRight);
      var reqData = {reqData: params};
      var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/projectModule/edit", reqData);
      if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
        var params = zUtil.valAll(IdDlgQueryRight);
        zUtil.tableQuery(IdTableRight,params);
        zUtil.dialogClose(IdDlgEditRight);
      }else{
        zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        return false;
      }
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditRight);
    };
    var dlgOptions = {
      title: TitleRight + '-编辑',
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgEditRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.valAll(IdDlgEditRight,detail);
    zUtil.dialogOpen(IdDlgEditRight);
  };
  //TODO
  function dlgDtlRight(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableRight,row);
      row = zUtil.tableRows(IdTableRight);
    }
    zUtil.formClear(IdDlgEditRight + ' form');
    zUtil.readonlyAll(IdDlgEditRight);
    
    var params = {};
    params['moduleId']  = row['moduleId'];
    var detail = zUtil.ajaxGetSync(zGlobal["http"] + "/api/autocode/projectModule/detail", params);
    if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(detail,zConst["busCode"])){
      zUtil.msg('获取信息失败');
      return false;
    }
    detail = detail[zConst["resData"]];
          
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditRight);
    };
    var dlgOptions = {
      title: TitleRight + '-详情',
    };
    var dlgButtonsIdx = [1];
    var dlgButtonsFunc =  [dlgClose];
    zUtil.dialogInit(IdDlgEditRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.valAll(IdDlgEditRight,detail);
    zUtil.dialogOpen(IdDlgEditRight);
  };
  //TODO
  function dlgDelRight(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableRight,row);
      row = zUtil.tableRows(IdTableRight);
    }
    
    var params = {}; 
    params['moduleId']  = row['moduleId'];
    var reqData = {reqData: params};
    var okfunc = function(){
      var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/projectModule/del", reqData);
      if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
        var params = zUtil.valAll(IdDlgQueryRight);
        zUtil.tableQuery(IdTableRight,params);
      }else{
        zUtil.msg('操作失败'+(result.busMsg?'. '+result.busMsg:''));
        return false;
      }
    }
    zUtil.msgConfirm("确认删除已选中记录?",okfunc);
  };
  
  
  /* --分割------------------------------------------------------------------------------ */
  
  //TODO  
  function dlgLoadTables (row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }else{
        row = getTableLeft();
        if(row == null){
          return false;
        };
    }
    $('#loadTablesResult tbody').empty();
    
    zUtil.formClear(IdDlgLoadTables + ' form');
    zUtil.readonly(IdDlgLoadTables + ' #projectId');
    zUtil.readonly(IdDlgLoadTables + ' #projectTitle');
    zUtil.val(IdDlgLoadTables + ' #projectId',row['projectId']);
    zUtil.val(IdDlgLoadTables + ' #projectTitle',row['projectTitle']);
    zUtil.val(IdDlgLoadTables + ' #loadTables',row['loadTables']);
    zUtil.val(IdDlgLoadTables + ' #loadSeqs',row['loadSeqs']);
    zUtil.val(IdDlgLoadTables + ' #loadType',row['loadType']);
    zUtil.val(IdDlgLoadTables + ' #loadSourceType','1');
    zUtil.val(IdDlgLoadTables + ' #coverFlag','1');
    zUtil.val(IdDlgLoadTables + ' #queryType','0');
        
    var dlgSave = function(){
      $('#loadTablesResult tbody').empty();
      var params = zUtil.valAll(IdDlgLoadTables);
      var reqData = {reqData: params};
      var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/loadtable", reqData);
      if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
        result = result[zConst["resData"]];
        $.each(result["warnTables"], function(k,v){
            $('#loadTablesResult tbody').append('<tr><td style="font-size: 10px;">' + k +'</td><td style="font-size: 10px;">' + v +'</td></tr>');
        });
      }else{
        zUtil.msg('同步失败'+(result.busMsg?'. '+result.busMsg:''));
        return false;
      }
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgLoadTables);
    };
    var dlgOptions = {
      title: TitleLeft + '-同步表',
    };
    var dlgButtonsIdx = [2,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgLoadTables,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgLoadTables);
  };
  
  /* --分割------------------------------------------------------------------------------ */
  //TODO
  function dlgFileLeft(row){
      if($.isNumeric(row)){
          zUtil.tableSelected(IdTableLeft,row);
          row = zUtil.tableRows(IdTableLeft);
      }
      zUtil.formClear(IdDlgFileLeft +' form');
      zUtil.val(IdDlgFileLeft + ' #fileType','1');
      
      var paramsx = {};
      paramsx["projectId"] = row.projectId;
      
      var initFileList = function(){
          var result = zUtil.ajaxGetSync(zGlobal["http"] + "/api/autocode/getProjectFiles", paramsx);
          if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取文件失败'+(result.busMsg?'. '+result.busMsg:''));
              return false;
          }else{
              result=result.resData;
              var filelist = result.fileList;
              
              var zNodes = [];
              for(var i=0;i<filelist.length;i++){
                  var node = filelist[i];
                  node['projectId'] = row['projectId'];
                  var newNode = {
                           id: node.id
                          ,pId: node.parentId
                          ,name: node.fileName
                          ,fileInfo: node
                          ,chkDisabled: true
                          ,nocheck: true
                  };
                  if(node.type === "0"){
                      newNode.open = true;
                  }
                  if(node.type !== "2"){
                      newNode.isParent = true;
                  }
                  zNodes.push(newNode);
              }
              var setting = {
                      data: {
                          simpleData: {
                              enable: true
                          },
                          keep: {
                              parent: true
                          },
                      },
                      edit: {
                          enable: true,
                          showRenameBtn: false,
                          showRemoveBtn: function(treeId, treeNode){
                              return treeNode['fileInfo']['type']==="2";
                          }
                      },
                      view: {
                          nameIsHTML: true,
                          addDiyDom: function(treeId, treeNode) {
                              var tdata = treeNode['fileInfo'];
                              var oprType = tdata['type'];
                              var idcode = tdata['id'];
                              var projectId = tdata['projectId'];
                              var diyObj = $('<button class="btn btn-info ztree-opr-btn" onclick="doDownloadFiles(\''+projectId+'\',\''+idcode+'\');">下载</button>');
                              if(oprType==="0"){
                                  diyObj.insertAfter($('#'+treeNode.tId+'_a'));
                              }
                          },
                      },
                      callback: {
//                            onClick : function(event, treeId, treeNode){}
                               beforeRemove: function(treeId, treeNode){
                                      var zTreeObj = $.fn.zTree.getZTreeObj(treeId);
                                      var params ={
                                              fileName: treeNode.fileInfo.fileName,
                                              projectId: row['projectId']
                                      };
                                      
                                      var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/delProjectFiles", {reqData: params});
                                      if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
                                          zUtil.msg('删除文件失败');
                                          return false;
                                      }
                                      return true;
                               },
                               onRemove: function(event, treeId, treeNode){
                                   var zTreeObj = $.fn.zTree.getZTreeObj(treeId);
                                   zTreeObj.expandAll(true);
                               }
                      }
             };
             
             //树形结构初始化
             $.fn.zTree.init($("#tree-code-file"), setting, zNodes);
          }
      };
      
      
      
      var dlgSave = function(){
        if(!zUtil.formCheck(IdDlgFileLeft +' form')){
          return false;
        };
        var options = {
          url: zGlobal["http"] + '/api/autocode/uploadproject',
          type: 'post',
          data: paramsx
        };
        var result = zUtil.formSubmit(IdDlgFileLeft + ' form', options)
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryLeft);
          
          initFileList();
          zUtil.formClear(IdDlgFileLeft +' form');
          zUtil.val(IdDlgFileLeft + ' #fileType','1');
        }else{
          zUtil.msg('上传失败'+(result.busMsg?'. '+result.busMsg:''));
          return false;
        }
      };
      var dlgClose = function(){
        zUtil.dialogClose(IdDlgFileLeft);
      };
      
      var dlgOptions = {
          title: TitleLeft + '-上传',
          width: 650,
          height: 350,
          onOpen: initFileList
      };
      var dlgButtonsIdx = [0,1];
      var dlgButtonsFunc =  [dlgSave,dlgClose];
      
      zUtil.dialogInit(IdDlgFileLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
      
      zUtil.dialogOpen(IdDlgFileLeft);
      
  }; 
  function doDownloadFiles(projectId,type){
      var token = $.sessionStorage('myToken');
      window.open(zGlobal["http"] + "/api/autocode/downloadProjectZip?projectId=" + projectId+"&fileType="+type+"&myToken="+token);
  }
  
  //选择表
  function dlgSelectTableInfo(){
    var params = {
                loadSourceType: "1",
                queryType: "1",
                projectId: zUtil.val(IdDlgLoadTables + ' #projectId'),
                loadType: zUtil.val(IdDlgLoadTables + ' #loadType'),
    };
    zUtil.valAll(IdDlgSelectTableInfo,params);
    
    var dlgSave = function(){
        var srows = zUtil.tableRows(IdTableInfo);
        if(srows && srows.length>0){
             var tableCodeArr = [];
             $.each(srows,function(i,item){
                tableCodeArr.push(item['tableCode']);
             });
             zUtil.val(IdDlgLoadTables+" #loadTables",  tableCodeArr.join(","));
        }
        zUtil.dialogClose(IdDlgSelectTableInfo);
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgSelectTableInfo);
    };
    var dlgOptions = {
      title: '表选择',
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgSelectTableInfo,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgSelectTableInfo);
    
    var options = {
            data : [],
            idField: 'tableCode',
            toolbar: IdTableInfoTb,
            method: "POST",
            singleSelect: false,
            columns:[[
                {field:'', title:'', align:'center', checkbox:true},
                {field: 'tableCode', title: '编码', align: 'center', width: 350},
                {field: 'tableName', title: '标题', align: 'center', width: 350},
                {field: 'tableComment', title: '注释', align: 'center', width: 350},
                {field: ' ', title: ' ', align: 'center', width: 30},
            ]],
    };
    zUtil.tableInit2(IdTableInfo,options);
    tableInfoQuery();
  }
  
  function tableInfoQuery(){
      zUtil.tableUnSelected(IdTableInfo);
      var params =zUtil.valAll(IdDlgSelectTableInfo);
      if(!params['loadTables']){
          params['loadTables'] = "_";
      }
      var reqData = {reqData: params};
      var result = zUtil.ajaxPostSync(zGlobal["http"] + "/api/autocode/getTableData", reqData);
      if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
        result = result[zConst["resData"]].dataInfos.tables;
      }else{
        zUtil.msg('获取数据失败');
        return false;
      }
      
      zUtil.tableData(IdTableInfo, result);
  }
  </script>

</body>
</html>